/*
Copyright (C) Ariff Ehsan, Abdul Hadi Fikri

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

/*  Author : Ariff Ehsan
 *  Date   : Jan 12, 2010
 *
 *  Info   : - Library LCD162 is used to control LCD 16x2 with 8-bit data
 *           - Data pins MUST be connected to a port while control pins
 *             can be assigned to any other port.
 *           - The LCD162 constants MUST be defined in user's anos_confing.h file.
 */


#ifndef __LCD162_H__
#define __LCD162_H__

#include <types/anos_error.h>

#ifndef LCD162_PORT
#error LCD162_PORT is not defined
#endif


#ifndef LCD162_DDR
#error LCD162_DDR is not defined
#endif


#ifndef LCD162_PIN
#error LCD162_PIN is not defined
#endif


#ifndef LCD162_CTRL_PORT
#error LCD162_CTRL_PORT is not defined
#endif


#ifndef LCD162_CTRL_DDR
#error LCD162_CTRL_DDR is not defined
#endif


#ifndef LCD162_RS_PIN
#error LCD162_RS_PIN is not defined
#endif


#ifndef LCD162_RW_PIN
#error LCD162_RW_PIN is not defined
#endif


#ifndef LCD162_E_PIN
#error LCD162_E_PIN is not defined
#endif


#ifndef LCD162_MAX_BUFF
#define LCD162_MAX_BUFF 20
#endif


/**
 *  Start using LCD 16x2 module
 */
void LCD162_reg(void (*startdone)(error_t));
error_t LCD162_start(void);

void LCD162_putChar(uint8_t chr);
void LCD162_putString(uint8_t* str, uint8_t len);


#endif // __LCD162_H__


